home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 January
/
PCWorld_2002-01_cd.bin
/
Novinky
/
Internet Explorer 6.0
/
iew2k_2.cab
/
mshtmler.dll
/
HTML
/
EDLINK.DLG
< prev
next >
Wrap
Text File
|
2001-08-17
|
9KB
|
344 lines
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
<HTML id=dlgLink style="font-family: MS Shell Dlg; font-size: 8pt;
width: 36.7em; height: 12.3em; ">
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="MSThemeCompatible" content="Yes">
<TITLE>Hyperlink</TITLE>
<SCRIPT>
function callHelp(elm)
{
if (null != elm.helpid)
{
window.showHelp(elm.helpfile, "" + parseInt(elm.helpid),
"popup");
}
else
{
if ("BODY" != elm.tagName)
{
callHelp(elm.parentElement);
}
}
}
function btnCancelClick()
{
window.close();
}
function getTextRange(elm)
{
var r = elm.parentTextEdit.createTextRange();
r.moveToElementText(elm);
return r;
}
function mouseClick()
{
if (window.event.srcElement.id.substring(0,3)
== "txt")
{
return;
}
if (window.event.button == 2)
{
callHelp(window.event.srcElement);
}
}
function txtDefaultESC()
{
if (event.keyCode == 27)
{
window.close();
return;
}
}
window.onerror = HandleError
var L_Dialog_ErrorMessage = "An error has occurred in this dialog.";
var L_ErrorNumber_Text = "Error: ";
function HandleError(message, url, line)
{
var str = L_Dialog_ErrorMessage + "\n\n"
+ L_ErrorNumber_Text + line + "\n"
+ message;
alert (str);
window.close();
return true;
}
var g_fOKEnabled = false;
var g_fURLLoaded = false;
function findAnchor(range)
{
var rangeWorking;
var elmWorking;
var index;
elmWorking = range.parentElement()
while ("HTML" != elmWorking.tagName)
{
if ("A" == elmWorking.tagName)
{
return elmWorking;
}
else
{
elmWorking = elmWorking.parentElement
}
}
rangeWorking = range.duplicate();
rangeWorking.collapse(true);
rangeWorking.moveEnd("character", 1);
while (rangeWorking.compareEndPoints("EndToEnd", range) < 0)
{
rangeWorking.move("Character");
if (null != findAnchor(rangeWorking))
{
return findAnchor(rangeWorking);
}
}
return null;
}
function getProtocolFromURL(strURL)
{
var index;
return strURL.substring(0, strURL.indexOf(":") + 1);
}
function updateProtocolSel()
{
var index;
var strProtocol = getProtocolFromURL(txtURL.value);
selProtocol.value = strProtocol;
if (selProtocol.value != strProtocol)
{
selProtocol.value = "";
}
}
function updateProtocolTxt()
{
var strSlashProts = " file:ftp:gopher:http:https:";
var strProtocolTxt = getProtocolFromURL(txtURL.value);
var strProtocolSel = selProtocol.value;
var strTempURL;
if ("//" == (txtURL.value.substring(strProtocolTxt.length,
strProtocolTxt.length + 2)))
{
strProtocolTxt = strProtocolTxt + "//";
}
strTempURL = txtURL.value.substring(strProtocolTxt.length);
if (0 < strSlashProts.indexOf(strProtocolSel))
{
strProtocolSel = strProtocolSel + "//";
}
txtURL.value = strProtocolSel + strTempURL;
}
function setOKState()
{
var htmlKeyAlt = 18;
if (!g_fURLLoaded)
{
if ((("" == txtURL.value) || (txtURL.value == selProtocol.value)
||(txtURL.value == selProtocol.value + "//"))
== g_fOKEnabled)
{
btnOK.disabled = g_fOKEnabled
g_fOKEnabled = !g_fOKEnabled;
}
}
}
function bdyLoad()
{
var globalDoc = window.dialogArguments;
var rngMaster;
var rngLink;
var elmLink;
document.onhelp = new
Function("callHelp(window.event.srcElement)");
document.onmouseup = new Function("mouseClick()");
selProtocol.onchange = new Function("updateProtocolTxt()");
btnOK.onclick = new Function("btnOKClick()");
btnCancel.onclick = new Function("btnCancelClick()");
txtURL.onfocus = new Function("txtURL.select()");
txtURL.onpropertychange = new Function("if (event.propertyName == 'value') setOKState();");
txtURL.onkeypress = new Function("txtDefaultESC()");
if ("Control" == globalDoc.selection.type)
{
rngMaster = globalDoc.selection.createRange();
if (1 == rngMaster.length)
{
rngMaster = getTextRange(rngMaster(0));
rngMaster.select();
}
}
if (("Text" == globalDoc.selection.type) ||
("None" == globalDoc.selection.type))
{
rngMaster = globalDoc.selection.createRange();
globalDoc.execCommand("AutoDetect");
elmLink = findAnchor(rngMaster);
if (null != elmLink)
{
rngLink = getTextRange(elmLink);
if (rngLink.compareEndPoints("StartToStart", rngMaster) < 0)
{
rngMaster.setEndPoint("StartToStart", rngLink);
}
if (rngLink.compareEndPoints("EndToEnd", rngMaster) > 0)
{
rngMaster.setEndPoint("EndToEnd", rngLink);
}
rngMaster.select();
if ("" != elmLink.href)
{
txtURL.value = elmLink.href;
txtURL.href = elmLink.href;
g_fURLLoaded = true;
btnOK.disabled = false;
}
updateProtocolSel();
}
txtURL.focus();
txtURL.select();
setOKState();
}
}
function IsRangeEmpty( range )
{
var tempRange;
tempRange = range.duplicate();
result = tempRange.compareEndPoints( "StartToEnd", range );
if ( result == 0 )
{
return true;
}
else
{
return false;
}
}
function btnOKClick()
{
var globalDoc = window.dialogArguments;
var cmdCreateLink = "CreateLink";
var cmdUnlink = "Unlink";
var range = globalDoc.selection.createRange();
var strSlashProts = " file:ftp:gopher:http:https:";
var strProtocol = selProtocol.value;
var dupRange;
var initialRange;
var iRight;
var fUseExecCommand = true;
if ("" == txtURL.value)
{
range.execCommand(cmdUnlink, false);
window.close();
return;
}
if (g_fURLLoaded && (txtURL.value == txtURL.href))
{
window.close();
return;
}
updateProtocolSel();
if (0 < strSlashProts.indexOf(strProtocol))
{
strProtocol = strProtocol + "//";
}
initialRange = range.duplicate();
if ( IsRangeEmpty( range ) )
{
range.text = txtURL.value;
fUseExecCommand = false;
}
else
{
dupRange = range.duplicate();
iRight = dupRange.moveEnd( "Character", 2 );
if ( iRight < 2 && dupRange.htmlText == "" )
{
range.text = txtURL.value;
fUseExecCommand = false;
}
}
if ( fUseExecCommand )
{
range.execCommand(cmdCreateLink, false, txtURL.value);
}
else
{
dupRange = range.duplicate();
dupRange.move( "Character", -1 );
elmParent = dupRange.parentElement();
if (elmParent.tagName == "A")
{
elmParent.href = txtURL.value;
}
else
{
range.setEndPoint( "StartToEnd", initialRange );
dupRange = range.duplicate();
dupRange.collapse(true);
elmParent = dupRange.parentElement();
if (elmParent.tagName == "A")
{
range.execCommand(cmdUnlink, false);
}
range.execCommand(cmdCreateLink, false, txtURL.value);
}
}
window.close();
}
</SCRIPT>
</HEAD>
<BODY id=bdy style="font-family: MS Shell Dlg; font-size: 8pt;
background: threedface; color: windowtext;"
onLoad="bdyLoad()" scroll=no>
<FIELDSET id=fldLink style="font-family: MS Shell Dlg; font-size: 8pt;
position: absolute; left: 0.98em; top: .8em; width: 25.76em;
height: 7.9em;">
<LEGEND id=lgdLink>
Hyperlink Information
</LEGEND>
</FIELDSET>
<DIV id=div2 style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 1.82em; top: 2.8899em; width: 2.66em; height: 1.2168em; ">
<LABEL id=lblProtocol FOR=selProtocol tabIndex=-1 helpid="35550"
helpfile=msoe.hlp>
<u>T</u>ype:
</LABEL>
</DIV>
<select id=selProtocol size=1 ACCESSKEY=t tabIndex=50
style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 5.04em; top: 2.7378em; width: 6.44em; height: 2.1294em; "
helpid="35550" helpfile=msoe.hlp>
<OPTION id=optOther value=""> (other) </OPTION>
<OPTION id=optFile value="file:"> file: </OPTION>
<OPTION id=optFtp value="ftp:"> ftp: </OPTION>
<OPTION id=optGopher value="gopher:"> gopher: </OPTION>
<OPTION id=optHttp value="http:" SELECTED> http: </OPTION>
<OPTION id=optHttps value="https:"> https: </OPTION>
<OPTION id=optMailto value="mailto:"> mailto: </OPTION>
<OPTION id=optNews value="news:"> news: </OPTION>
<OPTION id=optTelnet value="telnet:"> telnet: </OPTION>
<OPTION id=optWais value="wais:"> wais: </OPTION>
</select>
<DIV id=div3 style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 1.82em; top: 5.9319em; width: 2.52em; height: 1.2168em; ">
<LABEL id=lblURL FOR=txtURL tabIndex=-1 helpid="35550"
helpfile=msoe.hlp>
<u>U</u>RL:
</LABEL>
</DIV>
<input accesskey=u ID="txtURL" value="http://" type=text size=35
maxlength=1024 tabIndex=15 helpid="35550" helpfile=msoe.hlp
style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 5.04em; top: 5.6277em; width: 20.72em; height: 2.1294em; ">
<BUTTON id=btnOK tabIndex=35 DISABLED=1 helpid="28443" helpfile="windows.hlp"
style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 28em; top: 1.521em; width: 7em; height: 2.2em; " type=submit>
OK
</BUTTON>
<BUTTON id=btnCancel tabIndex=40 helpid="28444" helpfile="windows.hlp"
style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 28em; top: 4.1067em; width: 7em; height: 2.2em; " type=reset>
Cancel
</BUTTON>
</BODY>
</HTML>